#include "AI.h"

extern list<WordInfo> word_list;
extern list<WordInfo>::iterator word_it;

extern list<AdditionalInfo> additional_list;
extern list<AdditionalInfo>::iterator additional_it;

extern list<SlotInfo>* slot_list;

extern ofstream outFile;

void FillSlots()
{
	bool slotFlag;

	if(slot_list != NULL)
	{
		list<SlotInfo>::iterator slot_it;

		for(slot_it = slot_list->begin(); slot_it != slot_list->end(); slot_it++)
		{
			slotFlag = false;

			if(!slotFlag)
			{
				for(additional_it = additional_list.begin(); additional_it != additional_list.end(); additional_it++)
				{
					if(additional_it->type == slot_it->tag)
					{
						cout << slot_it->slotName << " [" << additional_it->word << ']' << endl;
						outFile << slot_it->slotName << " [" << additional_it->word << ']' << endl;
						slotFlag = true;
					}
				}
			}

			if(!slotFlag)
			{
				for(word_it = word_list.begin(); word_it != word_list.end(); word_it++)
				{
					if(word_it->type == slot_it->tag)
					{
						cout << slot_it->slotName << " [" << word_it->word << ']' << endl;
						outFile << slot_it->slotName << " [" << word_it->word << ']' << endl;
						slotFlag = true;
					}
				}
			}

			if(!slotFlag)
			{
				cout << slot_it->slotName << " [" << DefaultSlot(slot_it->tag) << ']' << endl;
				outFile << slot_it->slotName << " [" << DefaultSlot(slot_it->tag) << ']' << endl;
			}
		}
	}
}